# 行的初始值为1，列的初始值为1
# for循环九九乘法表1
for i in range(1,10):
    for j in range(1,i+1):
        print('{}*{}={:<4}'.format(i,j,i*j),end='    ')
    print('')

# while循环九九乘法表1
print('='*110)
i=1
while i<10:
    j=1
    while j<=i:
        print('{}*{}={:<4}'.format(j,i,i*j),end='    ')
        j = j + 1
    i=i+1
    print()

# 行的初始值为1，列的初始值为9
# for循环九九乘法表2
print('='*110)
for i in range(9,0,-1):
    for j in range(1,i+1):
        print('{}*{}={:<4}'.format(i,j,i*j),end='    ')
    print('')

# while循环九九乘法表2
print('='*110)
i=9
while i>0:
    j=1
    while j<=i:
        print('{}*{}={:<4}'.format(j,i,i*j),end='    ')
        j = j + 1
    i=i-1
    print()

# 行的初始值为9，列的初始值为1
# for循环九九乘法表3
print('='*110)
for i in range(1,10):
    # 不满足条件的输出空白
    for k in range(9-i):
        print(end='            ')
    for j in range(i,0,-1):
        print('{}*{}={:<4}'.format(j,i,i*j),end='    ')
    print()

# while循环九九乘法表3
print('='*110)
i=1
while i<10:
    j = 9
    while j > 0:
        # while循环不能设定多条件，结合if进行判断，满足条件显示结果，不满足则输出空白
        if j<=i:
            print('{}*{}={:<4}'.format(j,i , i * j), end='    ')
        else:
            print(end='            ')
        j = j -1
    i=i+1
    print()


# 行列均为9开头，则行列的初始值为9
# for循环九九乘法表4
print('='*110)
for i in range(9,0,-1):
    # 不满足条件的输出空白
    for k in range(9-i):
        print(end='            ')
    for j in range(i,0,-1):
        print('{}*{}={:<4}'.format(j,i,i*j),end='    ')
    print()

# while循环九九乘法表4
print('='*110)
i=9
while i>0:
    j = 9
    while j > 0:
        # while循环不能设定多条件，结合if进行判断，满足条件显示结果，不满足则输出空白
        if j<=i:
            print('{}*{}={:<4}'.format(j,i , i * j), end='    ')
        else:
            print(end='            ')
        j = j -1
    i=i-1
    print()